package com.javaee.service.user.impl;

import com.javaee.entity.Doctor;
import com.javaee.entity.Mzgh;
import com.javaee.mapper.user.AppointmentRepository;
import com.javaee.service.user.AppointmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import java.util.List;
import java.util.Map;

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    private AppointmentRepository appointmentRepository;
    public List<Doctor> findAll(){
        return appointmentRepository.queryAllDoctor();
    }
    public  List<Doctor> searchfromall(String mykey){
        return appointmentRepository.searchfromall(mykey);
    }
    public int selectCountDoctor(){
        return appointmentRepository.selectCountDoctor();
    }
    @Override
    public  List<Doctor> search(String mykey,String weekday){

        return appointmentRepository.search(mykey,weekday);
    }
    @Override
    public int selectCount(int Uid) {
        return appointmentRepository.selectCount(Uid);
    }

    @Override
    public List<Map<String, Object>> selectMyMzghByPage(int startIndex, int perPageSize, int Uid) {
        return appointmentRepository.selectMyMzghByPage(startIndex, perPageSize, Uid);
    }

    @Override
    public int deleteMzgh(int id) {
        return  appointmentRepository.deleteMzgh(id);
    }

    @Override
    public int updatePlan(int dId,String weekday) {
        return  appointmentRepository.updatePlan(dId,weekday);
    }

    @Override
    public Doctor findDoctorById(int dId) {
        return appointmentRepository.findDoctorById(dId);
    }

    @Override
    public int updateMyBalance(int Uid, double fee) {
        return  appointmentRepository.updateMyBalance(Uid, fee);
    }

    @Override
    public int selectCountByday(String weekday) {
        return  appointmentRepository.selectCountByday(weekday);
    }

    @Override
    public List<Doctor> findDoctorByPage(int startIndex, int perPageSize, String weekday) {
        return appointmentRepository.findDoctorByPage(startIndex, perPageSize, weekday);
    }

    @Override
    public int updatePlanReduce(int dId,String weekday) {
        return appointmentRepository.updatePlanReduce(dId,weekday);
    }

    @Override
    public int ReduceMyBalance(int Uid, double fee) {
        return appointmentRepository.ReduceMyBalance(Uid, fee);
    }

    @Override
    public int insertMzgh(Mzgh mzgh) {
        return appointmentRepository.insertMzgh(mzgh);
    }

    @Override
    public Mzgh findMzghById(int id) {
        return appointmentRepository.findMzghById(id);
    }
}
